class Solution {
    public:
        int fib(int n) {
                  int n1=1;
                        int n2=1;
                              if (n<2)
                                    return n;
                                          if (n==2)
                                                return 1;
                                                      while(n!=2){
                                                                    int temp=n2;
                                                                              n2=n1+n2;
                                                                                        n1=temp;
                                                                                                  n--;
                                                      } 
                                                            return n2; 
        }
};
                                                      }
        }
}